Add Keystore support to OSS JDBC Driver#830
Merged
Merged
Conversation
- Implemented client certificate authentication via keystore configuration parameters. - Updated `ConfiguratorUtils` to handle loading and managing keystores. - Enhanced unit tests to cover keystore loading and client certificate scenarios.
…method. - Simplified key entry verification by replacing Enumeration with a stream-based approach for better readability and performance.
gopalldb
reviewed
May 21, 2025
gopalldb
reviewed
May 21, 2025
gopalldb
reviewed
May 21, 2025
gopalldb
reviewed
May 21, 2025
gopalldb
reviewed
May 21, 2025
gopalldb
reviewed
Jun 5, 2025
gopalldb
reviewed
Jun 5, 2025
gopalldb
reviewed
Jun 5, 2025
gopalldb
reviewed
Jun 5, 2025
vikrantpuppala
left a comment
Collaborator
There was a problem hiding this comment.
can you add more testing details in description on how you verified the actual key store works, i don't think just unit tests would be enough
… remove obsolete DNS directive
…L/TLS errors. Update relevant classes and tests to replace DatabricksHttpException with DatabricksSSLException, ensuring proper error handling during SSL configuration and handshake processes.
…t SSL error handling instead of HTTP error. This change enhances clarity in logging and exception management related to SSL configuration failures.
vikrantpuppala
approved these changes
Jun 9, 2025
vikrantpuppala
left a comment
Collaborator
There was a problem hiding this comment.
Can you add testing details in the description, lgtm otherwise
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements SSL client certificate authentication support in the JDBC driver. The key implementation changes include:
Added a new
loadKeystoreOrNullmethod to load client keystores from the specified path, with proper validation and error handling.Added a
createKeyManagersmethod to generate key managers from the keystores, necessary for client certificate authentication in the SSL handshake.Enhanced
createSocketFactoryRegistryto support both server certificate validation (trust managers) and client certificate authentication (key managers).Modified the
createRegistryFromTrustAnchorsmethod to integrate keystore functionality with the existing truststore handling.Testing
Unit tests
Manual testing:
Manually created a keystore file (manual-test.jks) using the keytool command line utility.
Wrote a simple Java test that attempted to establish a connection using a validly-formatted JDBC URL pointing to localhost.
The test validated several scenarios:
A successful connection attempt with the correct keystore path and password.
A failed attempt with an incorrect password, expecting a specific exception.
A failed attempt with a non-existent keystore file, expecting a different specific exception.
Additional Notes to the Reviewer